<?php
$this->pageTitle = 'Upraviť používateľa';
?>
<div class="newForm">
	<h3>Upraviť používateľa</h3>
	<?php echo $this->Form->create('User'); ?>
		<fieldset>
			<?php
				echo $this->Form->input('username', array('label' => 'Používateľské meno'));

				echo '<div class="checkbox"><label for="UserChangePassword">Zmeniť heslo</label>';
				echo $this->Form->checkbox('change_password', array('class' => 'checkbox', 'onchange'=> '$("new-password").toggle();return false;'));
				echo '</div>';

				echo '<div style="display:none;" id="new-password">';
				echo $this->Form->input('password', array('label' => 'Nové heslo'));
				echo '</div>';

				$options = array(
					0 => 'Vyberte osobu, ku ktorej konto patrí'
				);

				foreach ($personList as $person) {
					$options[$person['Person']['id']] = $person['Person']['full_name'] . ($person['PersonType']['title'] ? ' - ' . $person['PersonType']['title'] : '');
				}

				echo $this->Form->input('fk_person_id', array('label' => 'Osoba', 'options' => $options));
				
				echo '<div class="checkbox"><label for="UserRestrictedAccess">Obmedzený prístup</label>';
				echo $this->Form->checkbox('restricted_access');
				echo '</div>';
			?>
		</fieldset>
	<?php echo $this->Form->end(__('Uložiť')); ?>
</div>